package com.midrange.rse_enhancements;

/*  This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import org.eclipse.jface.viewers.*;

import com.ibm.etools.iseries.core.util.ISeriesDataElementUtil;
import com.ibm.etools.systems.dstore.core.model.*;

public class DescriptionDecorator 
extends LabelProvider  
implements ILightweightLabelDecorator {

    public DescriptionDecorator() {
        super();
    }


    /**
     * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
     */
    public void decorate(Object element, IDecoration decoration) {
        if (element instanceof DataElement) {
            DataElement de = (DataElement)element;
            String description = ISeriesDataElementUtil.getDescription(de);
            if (description.length() > 0) {
                decoration.addSuffix(" (" + description + ")");
            }
        }
    }



}
